<?php


/**
 * Radcodes - SocialEngine Module
 *
 * @category   Application_Extensions
 * @package    Gmap
 * @copyright  Copyright (c) 2009-2010 Radcodes LLC (http://www.radcodes.com)
 * @license    http://www.radcodes.com/license/
 * @version    $Id$
 * @author     Vincent Van <vincent@radcodes.com>
 */
 
 
?>

<div class='layout_right'>
  <div class='gmaps_gutter'>
  
    <div class='gmaps_gutter_owner'>
      <?php echo $this->htmlLink($this->owner->getHref(), $this->itemPhoto($this->owner, 'thumb.profile'), array('class'=>'gmaps_gutter_owner_photo')) ?>
      <div class='gmaps_gutter_owner_name'>
        <?php echo $this->htmlLink($this->owner->getHref(), $this->owner->getTitle(), array('class'=>'gmaps_gutter_name')); ?>      
      </div>
    </div> 


    
		<?php $photoCount = $this->paginator->getTotalItemCount(); ?>
		<?php if ($photoCount): ?>
		<div class="gmap_photos">
      <h4><?php 
        $album_link = $this->htmlLink(array(
            'route' => 'gmap_extended',
            'controller' => 'photo',
            'action' => 'list',
            'subject' => $this->gmap->getGuid(),
          ), $this->translate(array("%s Photo", "%s Photo", $photoCount), $photoCount), array(
        ));
        
        echo $this->translate('Album (%s)', $album_link)?>
      </h4>
      
			<ul class="thumbs thumbs_nocaptions">
			  <?php foreach( $this->paginator as $photo ): ?>
		      <li>
					  <a class="thumbs_photo" href="<?php echo $photo->getHref(); ?>">
					    <span style="background-image: url(<?php echo $photo->getPhotoUrl('thumb.normal'); ?>);"></span>
					  </a>
		      </li>
			  <?php endforeach;?>
			</ul>
      
		</div>
		<?php endif; ?> 
    
    <?php $gmapsCount = $this->paginatorGmaps->getTotalItemCount(); ?>
    <?php if ($gmapsCount): ?>
      <h4><?php echo $this->translate('Other Gmaps')?></h4>
      <ul class="gmaps_gutter_gmaps">
        <?php foreach ($this->paginatorGmaps as $item): ?>
          <li>
            <div class='gmap_photo'>
              <?php echo $this->htmlLink($item->getHref(), $this->itemPhoto($item, 'thumb.icon')) ?>
            </div>
            <div class='gmap_title'>
              <?php echo $this->htmlLink($item->getHref(), $item->getTitle()) ?>
            </div>
            <div class='gmap_stats'>
              <?php echo $this->translate(array("%s view", "%s views", $item->view_count), $item->view_count); ?>
              - <?php echo $this->translate(array("%s comment", "%s comments", $item->comment_count), $item->comment_count); ?>
            </div>
            <div class='gmap_date'>
              <?php echo $this->timestamp(strtotime($item->creation_date)) ?>
            </div>
          </li>  
        <?php endforeach; ?>
      </ul>
      
	    <ul class='gmaps_gutter_options'>
	      <li><a href='<?php echo $this->url(array('user_id' => $this->owner->getIdentity()), 'gmap_list', true) ?>' class='buttonlink icon_gmap_list'><?php echo $this->translate('%1$s\'s Gmaps', $this->owner->getTitle());?></a></li>
	    </ul>
      
    <?php endif; ?>
  </div>
  <!-- /gmaps_gutter -->
  
</div>
<!-- /layout_right -->

<div class='layout_middle'>
  <h2 class="gmap_header_title">
    <?php echo $this->translate('%1$s\'s Gmap', $this->htmlLink($this->owner->getHref(), $this->owner->getTitle()))?>
  </h2>
  
    <div class='gmap_view<?php if ($this->gmap->featured):?> gmap_view_featured<?php endif;?><?php if ($this->gmap->sponsored):?> gmap_view_sponsored<?php endif;?>'>
      <h3>
        <?php echo $this->gmap->getTitle() ?>
        <?php if( $this->gmap->featured ): ?>
          <img src='application/modules/Gmap/externals/images/featured.png' class='gmap_title_icon_featured' />
        <?php endif;?>
        <?php if( $this->gmap->sponsored ): ?>
          <img src='application/modules/Gmap/externals/images/sponsored.png' class='gmap_title_icon_sponsored' />
        <?php endif;?>
      </h3>
      <div class="gmap_address">
        <?php echo $this->gmapAddressLink($this->google_map, $this->gmap)?>
      </div>
      
      <div class="gmap_body">
        <?php echo nl2br($this->gmap->description); ?>
      </div>
      
      <div class="gmap_view_map_wrapper">
        <?php echo $this->gmapMarker($this->google_map, $this->gmap, array('width'=>'740px','height'=>'500px')); ?>
      </div>
      
      
      
      <?php if ($gmap_field_values = $this->fieldValueLoop($this->gmap, $this->fieldStructure)): ?>
      <div class="profile_fields gmap_profile_fields">
        <h4>
          <span><?php echo $this->translate('Gmap Details');?></span>
        </h4>
        <?php echo $gmap_field_values; ?>
      </div>
      <?php endif; ?>
      
  
      <div class="gmap_date">
        <?php echo $this->timestamp($this->gmap->creation_date) ?>
        - <?php echo $this->translate(array("%s view", "%s views", $this->gmap->view_count), $this->gmap->view_count); ?>
        <?php if ($this->category):?>
          - <?php $category_url = $this->htmlLink(array('route' => 'gmap_browse', 'category' => $this->category->category_id), $this->translate($this->category->category_name)); 
            echo $this->translate('Posted in %s', $category_url);
          ?>
            
        <?php endif; ?>
        <?php if (count($this->gmapTags )):?>
        -
          <?php foreach ($this->gmapTags as $tag): ?>
          <?php if (!empty($tag->getTag()->text)):?>
            <?php echo $this->htmlLink(array(
              'route' => 'gmap_browse',
              'tag' => $tag->getTag()->tag_id
            ),
            '#'.$tag->getTag()->text
            ); ?>
          <?php endif; ?>
          <?php endforeach; ?>
        <?php endif; ?>
      </div>
      
      <div class="gmap_tool_links">
			  <?php echo $this->htmlLink(Array('module'=> 'activity', 'controller' => 'index', 'action' => 'share', 'route' => 'default', 'type' => 'gmap', 'id' => $this->gmap->getIdentity(), 'format' => 'smoothbox'), $this->translate("Share"), array('class' => 'smoothbox')); ?>
			  - <?php echo $this->htmlLink(Array('module'=> 'core', 'controller' => 'report', 'action' => 'create', 'route' => 'default', 'subject' =>  $this->gmap->getGuid(), 'format' => 'smoothbox'), $this->translate("Report"), array('class' => 'smoothbox')); ?>
      </div>
      
	    <ul class='gmap_action_options'>
	      <?php if($this->paginator->getTotalItemCount() && false): ?>
	      <li>
	          <?php echo $this->htmlLink(array(
	              'route' => 'gmap_extended',
	              'controller' => 'photo',
	              'action' => 'list',
	              'subject' => $this->gmap->getGuid(),
	            ), $this->translate('View Gmap Photos'), array(
	              'class' => 'buttonlink icon_gmap_photo_view'
	          )) ?>
	      </li>
	      <?php endif;?>
	      
	      <?php if ($this->canEdit):?>
	      <li>
	        <a href='<?php echo $this->url(array('gmap_id' => $this->gmap->gmap_id), 'gmap_edit', true) ?>' class='buttonlink icon_gmap_edit'><?php echo $this->translate('Edit This Gmap');?></a>
	      </li>
	      <?php endif; ?>  
	      <?php if( $this->canUpload ): ?>
	      <li>
	          <?php echo $this->htmlLink(array(
	              'route' => 'gmap_extended',
	              'controller' => 'photo',
	              'action' => 'upload',
	              'subject' => $this->gmap->getGuid(),
	            ), $this->translate('Add Photos'), array(
	              'class' => 'buttonlink icon_gmap_photo_new'
	          )) ?>
	      </li>
	      <?php endif; ?>
	      <?php if( $this->canDelete ): ?>
	        <li>
	          <a href='<?php echo $this->url(array('gmap_id' => $this->gmap->gmap_id), 'gmap_delete', true) ?>' class='buttonlink icon_gmap_delete'><?php echo $this->translate('Delete Gmap');?></a>
	        </li>
	      <?php endif; ?>
	
	    </ul>      

    </div>

  <?php echo $this->action("list", "comment", "core", array("type"=>"gmap", "id"=>$this->gmap->getIdentity())) ?>
</div>